package com.university.handler;

import com.university.infrastructure.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Date: 2021/5/8 0:05
 * @Description: 异常处理拦截器
 */
@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result appExceptionHandler(Exception e) {
        return Result.failure(404, e.getMessage());
    }

}
